import  pyautogui as pat
import time
from PIL import Image
import test
def 龙力():
    #915,385;980,460
    while True:
        e = "915,385；980,460"
        e1 = e.split("；")
        e1_0 = e1[0].split(",")
        a = int(e1_0[0])
        b = int(e1_0[1])
        e2_0 = e1[1].split(",")

        c = int(e2_0[0])
        d = int(e2_0[1])

        c = c - a
        d = d - b

        img = pat.screenshot(region=[a, b, c, d])
        img.save("now.png")

        img1 = Image.open("now.png")
        img2 = Image.open("龙力.png")
        if test.second(img1, img2):

            pat.click(x=1190, y=590)
            break

    while True:
        e = "810,230；1080,310"
        e1 = e.split("；")
        e1_0 = e1[0].split(",")
        a = int(e1_0[0])
        b = int(e1_0[1])
        e2_0 = e1[1].split(",")

        c = int(e2_0[0])
        d = int(e2_0[1])

        c = c - a
        d = d - b

        img = pat.screenshot(region=[a, b, c, d])
        img.save("now.png")
        img1 = Image.open("now.png")
        img2 = Image.open("常见结束/战斗胜利确定.png")
        if test.second(img1, img2):
            pat.click(x=940,y=600)
            for t in range(3):
                pat.click(x=950, y=530)
            break
        else:
            if int(time.time())%3==0:
                pat.click(x=1180, y=690)
            else:
                pat.click(x=860,y=690)
            time.sleep(3)